export const repairstatus = {
    // 未完成
    pending: '1',
    // 处理中
    processing: '2',
    // 评价中
    beevaluation: '3',
    // 已完成
    completed: '4'
};

export const repairactions = {
    // 设备档案
    view_device_profile: 'view_device_profile',
    // 编辑
    edit: 'edit',
    // 接单
    accept: 'accept',
    // 派工
    dispatch: 'dispatch',
    // 转派
    transfer: 'transfer',
    // 处理 结单 记录更改保存
    deal: 'deal',
    // 评价链接
    copy_evaluation_link: 'copy_evaluation_link',
    // 邀请评价
    invite_to_valuate: 'invite_to_valuate',
    // 记录详情
    record: 'record',
    // 评价
    evaluate: 'evaluate'
};

const {
    pending,
    // 处理中
    processing,
    // 评价中
    beevaluation,
    // 已完成
    completed
} = repairstatus;

const {
    // 设备档案
    view_device_profile,
    // 编辑
    edit,
    // 接单
    accept,
    // 派工
    dispatch,
    // 转派
    transfer,
    // 处理
    deal,
    // 评价链接
    copy_evaluation_link,
    // 邀请评价
    invite_to_valuate,
    // 记录详情
    record,
    // 评价
    evaluate
} = repairactions;

export const maintainadmin = 'maintainadmin';
export const maintainer = 'maintainer';
export const norole = 'norole';
export const nologin = 'nologin';

export const userFunctionMap = {
    [pending]: {
        [maintainer]: {
            [view_device_profile]: true,
            [edit]: 'creator',
            [accept]: true
        },
        [maintainadmin]: {
            [view_device_profile]: true,
            [edit]: true,
            [dispatch]: true,
            [accept]: true
        },
        [norole]: {
            [view_device_profile]: false,
            [edit]: 'creator'
        },
        [nologin]: {
            [view_device_profile]: false

        }
    },
    [processing]: {
        [maintainer]: {
            [view_device_profile]: true,
            [transfer]: 'owner',
            [deal]: 'owner',
            [record]: 'other'
        },
        [maintainadmin]: {
            [view_device_profile]: true,
            [transfer]: true,
            [deal]: 'owner',
            [record]: 'other'
        },
        [norole]: {
            [view_device_profile]: false,
            [record]: 'selfphone'
        },
        [nologin]: {
            [view_device_profile]: false

        }
    },
    [beevaluation]: {
        [maintainer]: {
            [view_device_profile]: true,
            [copy_evaluation_link]: 'owner',
            [invite_to_valuate]: 'owner',
            [record]: true
        },
        [maintainadmin]: {
            [view_device_profile]: true,
            [copy_evaluation_link]: true,
            [invite_to_valuate]: true,
            [record]: true,
            [evaluate]: true
        },
        [norole]: {
            [view_device_profile]: false,
            [record]: 'selfphone',
            [evaluate]: 'selfphone'
        },
        [nologin]: {
            [view_device_profile]: false,
            [evaluate]: 'selfphone'
        }
    },
    [completed]: {
        [maintainer]: {
            [view_device_profile]: true,
            [record]: true
        },
        [maintainadmin]: {
            [view_device_profile]: true,
            [record]: true
        },
        [norole]: {
            [view_device_profile]: false,
            [record]: 'selfphone'
        },
        [nologin]: {
            [view_device_profile]: false
        }
    }
};
